#ifndef __GfxDriver_VertexElement_h__
#define __GfxDriver_VertexElement_h__

#include "Core/BasicTypes.h"

namespace Orca {

	//-----------------------------------------------------------------------------
	enum VertexElementUsage {
		VEU_POS,
		VEU_NORMAL,
		VEU_DIFFUSE,
		VEU_TEXCOORD,
	};

	enum VertexElementDataType {
		VEDT_FLOAT	= 0x00000001,
		VEDT_BYTE	= 0x00000002,
		VEDT_UBYTE	= 0x00000003,
		VEDT_SHORT	= 0x00000004,
		VEDT_USHORT	= 0x00000005,
		VEDT_INT	= 0x00000006,
		VEDT_UINT	= 0x00000007,
		VEDT_RGBA	= 0x00000008,
	};

	enum VertexElementDataCnt {
		VEDC_ONE	= 0x00010000,
		VEDC_TWO	= 0x00020000,
		VEDC_THREE	= 0x00030000,
		VEDC_FOUR	= 0x00040000,
	};

	//-----------------------------------------------------------------------------
	struct VertexElement {

		uint32 offset;
		VertexElementUsage usage;
		uint32 format;
		uint32 index;

		VertexElement(
			  VertexElementUsage inUsage
			, uint32 inFormat
			, uint32 inIndex = 0);

		static uint32 getElementSize(uint32 format);
	};

	#define VE_XYZ()			VertexElement(VEU_POS, VEDT_FLOAT | VEDC_THREE)
	#define VE_XYZW()			VertexElement(VEU_POS, VEDT_FLOAT | VEDC_FOUR)
	#define VE_NORMAL()			VertexElement(VEU_NORMAL, VEDT_FLOAT | VEDC_THREE)
	#define VE_TEXCOORD2(index)	VertexElement(VEU_TEXCOORD, VEDT_FLOAT | VEDC_TWO, index)
	#define VE_TEXCOORD3(index)	VertexElement(VEU_TEXCOORD, VEDT_FLOAT | VEDC_THREE, index)
	#define VE_TEXCOORD4(index)	VertexElement(VEU_TEXCOORD, VEDT_FLOAT | VEDC_FOUR, index)
	#define VE_DIFFUSE()		VertexElement(VEU_DIFFUSE, VEDT_RGBA)
	#define VE_DIFFUSE_3F()		VertexElement(VEU_DIFFUSE, VEDT_FLOAT | VEDC_THREE)
	#define VE_DIFFUSE_4F()		VertexElement(VEU_DIFFUSE, VEDT_FLOAT | VEDC_FOUR)

	
}

#endif	// __GfxDriver_VertexElement_h__